#ifndef __CX32l003_GPIO_IIC_H
#define __CX32l003_GPIO_IIC_H

#include "cx32l003_gpio.h"


#define  DEBUG_IIC_SDA_GPIO_PORT       GPIOD   
#define  DEBUG_IIC_SDA_PIN             GPIO_Pin_6
#define  DEBUG_IIC_SDA_PIN_SOURCE      GPIO_PinSource6

#define  DEBUG_IIC_SCL_GPIO_PORT       GPIOD   
#define  DEBUG_IIC_SCL_PIN             GPIO_Pin_5
#define  DEBUG_IIC_SCL_PIN_SOURCE      GPIO_PinSource5

#define SDA_OUT(a)  if(a) \
	                     GPIO_SetBits(DEBUG_IIC_SDA_GPIO_PORT, DEBUG_IIC_SDA_PIN);\
	                  else \
	                     GPIO_ResetBits(DEBUG_IIC_SDA_GPIO_PORT, DEBUG_IIC_SDA_PIN)
										
#define SCL_OUT(a)  if(a) \
	                     GPIO_SetBits(DEBUG_IIC_SCL_GPIO_PORT, DEBUG_IIC_SCL_PIN);\
	                  else \
	                     GPIO_ResetBits(DEBUG_IIC_SCL_GPIO_PORT, DEBUG_IIC_SCL_PIN)
                       	




void IIC_SDA(uint8_t a);
void IIC_SCL_Init(void);
void IIC_Start(void); //IIC
void IIC_Stop(void);//IIC
void IIC_Ack(void);//ACK
void IIC_NAck(void);//ACK
uint8_t IIC_Wait_Ack(void); //
void IIC_Send_Byte(uint8_t txd);//IIC
uint8_t IIC_Read_Byte(uint8_t ack);//IIC
uint8_t EE_Write_Len(uint8_t *buf,uint8_t len);//IIC
uint8_t EE_Read_Len(uint8_t *commbuf,uint8_t commlen,uint8_t *buf,uint8_t len);//IIC								

#endif